home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / agrep / compat.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  1KB  |  58 lines

  1. /* test the conflicts between options */
  2. #include <stdio.h>
  3.  
  4. extern int FILENAMEONLY, APPROX, PAT_FILE, COUNT, INVERSE, BESTMATCH;
  5. extern FILEOUT;
  6. extern REGEX;
  7. extern DELIMITER;
  8. extern WHOLELINE;
  9. extern LINENUM;
  10. extern I, S, DD;
  11. extern JUMP;
  12. extern char Progname[32];
  13.  
  14. compat()
  15. {
  16. int i, j, k;
  17.     if(BESTMATCH)  if(COUNT || FILENAMEONLY || APPROX || PAT_FILE) {
  18.         BESTMATCH = 0;
  19.         fprintf(stderr, "WARNING!!! -B option ignored when -c, -l, -f, or -# is on\n", Progname);
  20.     }
  21.     if(PAT_FILE)   {
  22.         if(APPROX)  {
  23.             fprintf(stderr, "WARNING!!!  approximate matching is not supported with -f option\n");
  24.         }
  25. /*
  26.         if(INVERSE) {
  27.             fprintf(stderr, "%s: -f and -v are not compatible\n", Progname);
  28.             exit(2);
  29.         }
  30. */
  31.         if(LINENUM) {
  32.             fprintf(stderr, "%s: -f and -n are not compatible\n", Progname);
  33.             exit(2);
  34.         }
  35.         if(DELIMITER) {
  36.             fprintf(stderr, "%s: -f and -d are not compatible\n", Progname);
  37.             exit(2);
  38.         }
  39.     }
  40.     if(JUMP) {
  41.         if(REGEX) {
  42.             fprintf(stderr, "WARNING!!! -D#, -I#, or -S# option is ignored for regular expression pattern\n");
  43.             JUMP = 0;
  44.         }
  45.         if(I == 0 || S == 0 || DD == 0) {
  46.             fprintf(stderr, "%s: the error cost cannot be 0\n", Progname);
  47.             exit(2);
  48.         }
  49.     }
  50.     if(DELIMITER) {
  51.         if(WHOLELINE) {
  52.             fprintf(stderr, "%s: -d and -x is not compatible\n", Progname);
  53.             exit(2);
  54.         }
  55.     }
  56.  
  57. }
  58.